//
//  HDXiangQingViewController.m
//  qiJi
//
//  Created by 凤利史 on 2018/4/13.
//  Copyright © 2018年 sunrose. All rights reserved.
//

#import "HDXiangQingViewController.h"
#import "HDXianXiaBaoMingViewController.h"
#import "HDXiangQingTableViewCell.h"

@interface HDXiangQingViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *dataArr;

@end

@implementation HDXiangQingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self creationView];
    [self regeditCell];
    
    // Do any additional setup after loading the view.
}
- (void)creationView{
    self.title = @"赛事报名";
    UIView *threadView = [[UIView alloc]initWithFrame:CGRectMake(0, 1, DEF_SCREEN_WIDTH, 1)];
    threadView.backgroundColor = getColor(@"E6E6E6");
    [self.view addSubview:threadView];
    
    UIView *footView = [[UIView alloc] init];
    [self.view addSubview:footView];
    [footView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view);
        make.right.equalTo(self.view);
        make.height.offset(60);
        make.bottom.equalTo(self.view);
        
    }];
    footView.backgroundColor = getColor(@"FED500");
    
    UIButton *baoMingBtn = [[UIButton alloc] init];
    [footView addSubview:baoMingBtn];
    [baoMingBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(footView);
        make.centerY.equalTo(footView);
        make.height.offset(40);
        
    }];
    [baoMingBtn setTitle:@"立即报名" forState:UIControlStateNormal];
    [baoMingBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    baoMingBtn.titleLabel.font = [UIFont systemFontOfSize:20];
    [baoMingBtn addTarget:self action:@selector(baoMingClik) forControlEvents:UIControlEventTouchUpInside];
    
    self.tableView = [[UITableView alloc] init];
    self.tableView.frame = CGRectMake(0, 2, DEF_SCREEN_WIDTH, DEF_SCREEN_HEIGHT - (KIsiPhoneX?84:64) - 62);
    
    self.tableView.tableFooterView = [[UITableView alloc] initWithFrame:CGRectZero];
    
    self.tableView.backgroundColor = [UIColor whiteColor];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.estimatedRowHeight = 800;
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.view addSubview:self.tableView];
    
    
    
}
- (void)regeditCell{
    
    
    
    [self.tableView registerNib:[UINib nibWithNibName:@"HDXiangQingTableViewCell" bundle:nil] forCellReuseIdentifier:@"HDXiangQingTableViewCell"];
    
}

#pragma mark - ---------- Section的数量 ----------
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

#pragma mark - ---------- 每个Section的高度 ----------
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0;
}

#pragma mark - ---------- Cell的数量 ----------
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
    
    
}

#pragma mark - ---------- 每个Cell的高度 ----------
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    return UITableViewAutomaticDimension;
    
}
#pragma mark - ---------- 每个Cell的内容 ----------
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    HDXiangQingTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"HDXiangQingTableViewCell" forIndexPath:indexPath];
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    
    
    return cell;
    
    
}

#pragma mark - ---------- 每个Cell的点击事件 ----------
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    
    
    
}


//报名
- (void)baoMingClik{
    HDXianXiaBaoMingViewController *vc = [[HDXianXiaBaoMingViewController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
    
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
